#include <stdio.h>

int quickasort(int *arr,int a,int b);
int view(int *arr);

int main(int argc, const char *argv[])
{

	int arr[10]={0,3,5,7,9,10,8,6,4,2};

	int a=0;
	int b=9;

	quickasort(arr,a,b);
	view(arr);

	return 0;
}

int quickasort(int *arr,int a,int b)
{
	if(a<b)
	{
		int low=a;
		int high=b;
		int flag=arr[a];

		while(a!=b)
		{

			while(a!=b&&flag>=arr[b])
			{
				b--;
			}
			if(a<b)
			{
				arr[a++]=arr[b];
			}

			while(a!=b&&flag<=arr[a])
			{
				a++;
			}
			if(a<b)
			{
				arr[b--]=arr[a];
			}
		}
		arr[a]=flag;


		int mid =a;
		quickasort(arr,low,mid-1);
		quickasort(arr,mid+1,high);
	}
	return 0; 

}

int view(int *arr)
{
	int i;
	for(i=0;i<10;i++)
	{
		printf("%d ",arr[i]);
	}
	return 0;
}
